<%@ page language="java" import="java.util.*,bookstore.database.pojo.*"
	pageEncoding="UTF-8"%>
<%
	Book book = (Book) request.getAttribute("book");
	String picPath = book.getImage().getImagePath();
	String name = book.getBname();
	String press = book.getPress();
	String isbn = book.getIsbn();
	String author = book.getAuthor();
	String price = book.getBprice().toString();
	List<SaleTable> sales = new SaleTableDAO().findByIsbn(isbn);
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>

		<title>我mai 书籍</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<link rel="stylesheet" type="text/css" href="/css/my.css">

		<script type="text/javascript">
//返回主界面
function returnMain() {

	window.open("index.jsp", "_self");
}

function addBook(isbn,info){
	window.open("cart.do?addisbn="+ isbn + "&addsellerid="+ info,"_self");
}

</script>
	</head>

	<body>
		<table width="80%" border="0" align="center">
			<tr>
				<td colspan="3">
					<div align="center"><jsp:include flush="true" page="head.jsp"></jsp:include></div>
				</td>
			</tr>
			<tr>
				<td colspan="3">
					<div align="right">
						<span class="style3"> <input type="submit" name="Submit2"
								onclick="returnMain();" value="返回" /> </span>
					</div>
				</td>
			</tr>
			<tr>
				<td width="30%" colspan="2" rowspan="5">
					<img src=<%=picPath%> width="300" height="300" />
				</td>
				<td height="60" class="style3"><%=name%></td>
			</tr>
			<tr>
				<td height="60">
					<span class="style3">作者:<%=author%> </span>
					<hr />
				</td>
			</tr>
			<tr>
				<td height="60">
					定价：￥
					<%=price%></td>
			</tr>
			<tr>
				<td height="60">
					出版社：<%=press%></td>
			</tr>
			<tr>
				<td height="60">
					ISBN：<%=isbn%></td>
			</tr>
			<tr>
				<td colspan="3">
					<hr />
					&nbsp;
				</td>
			</tr>
			<tr>
				<td colspan="3">
					<div align="center">
						<span class="style3">卖家信息</span>
					</div>
					<div align="center"></div>
				</td>
			</tr>
			<tr>
				<td>
					<div align="center">
						卖家
					</div>
				</td>
				<td>
					<div align="center">
						售价
					</div>
				</td>
				<td width="33%">
					<div align="center"></div>
				</td>
			</tr>
			<%
				for (int i = 0; i < sales.size(); i++) {
					SaleTable sale = sales.get(i);
			%>
			
			<% //	String href1 = "javascript:window.open('cart.do?addisbn="
			//				+ isbn + "&addsellerid="
			//				+ sale.getSeller().getSellerId().toString()
			//				+ "','_self')";%>
			
			<tr>
				<td>
					<div align="center">
						<%
							Seller seller = new SellerDAO().findById(sale.getSeller()
										.getSellerId());
						%>
						<%=seller.getCustomer().getCustomerName()%>
					</div>
				</td>
				<td>
					<div align="center">
						￥<%=sale.getSalPrice().toString()%>
					</div>
				</td>
				<td width="33%">
					<div align="center">
						<span class="style3"> <input type="button" value="加入购物车"
								onClick="addBook(<%=isbn %>,<%=sale.getSeller().getSellerId().toString() %>)" /> </span>
					</div>
				</td>
			</tr>
			<%
				}
			%>


			
			
			
			
			<tr>
				<td colspan="3">
					<hr/>&nbsp;
				</td>
			</tr>
			<tr>
				<td colspan="3">
					<div align="center"><jsp:include flush="true" page="tail.jsp"></jsp:include></div>
				</td>
			</tr>
		</table>
	</body>
</html>
